package com.tchhy.provider.repository

import com.tchhy.provider.api.CommonApi
import com.tchhy.provider.data.partner.MedicineKitApplyInfo
import com.tchhy.provider.data.partner.MedicineRequestModel
import com.tchhy.provider.net.RetrofitFactory
import com.tchhy.provider.api.partnerapi.WorkApi
import com.tchhy.provider.data.common.*
import com.tchhy.provider.data.healthy.request.CheckCaptchaReq
import com.tchhy.provider.data.healthy.response.CheckCaptchaRes
import com.tchhy.provider.data.partner.request.ApplyDrugExaminationListResponseInfo
import com.tchhy.provider.data.partner.response.DataListRes
import io.reactivex.Observable

/**
 * @author: admin
 * @date: 2019/8/20
 * @des:
 *
 **/
class CommonRepository : BaseRepository(){

    /**
     * @description 获取药箱申请数量
     * @param account 数量
     * @return
     * @author admin
     * @time 2019/8/20
     */
    fun getMedicineKitApplyAccount(obj: MedicineRequestModel): Observable<BaseResp<MedicineKitApplyInfo>>{
        return RetrofitFactory.instance
            .createApiService(CommonApi::class.java)
            .getMedicineKitApplyAccount(getRequestJsonBody(obj))
    }

    //申请药箱列表
    fun applyExamationDrugList(): Observable<BaseResp<DataListRes<ApplyDrugExaminationListResponseInfo>>> {
        return  RetrofitFactory.instance
            .createApiService(WorkApi::class.java)
            .examinationList()
    }


    /**
     * @description 安全退出登录
     * @param
     * @return
     * @author admin
     * @time 2019/8/20
     */
    fun logout(): Observable<EmptyResp>{
        return  RetrofitFactory.instance
            .createApiService(CommonApi::class.java)
            .logout()
    }

    /**
     * @description 获取验证码
     * @param
     * @return
     * @author admin
     * @time 2019/8/20
     */
    fun sendCaptcha(smsVO: SmsVO): Observable<EmptyResp>{
            return  RetrofitFactory.instance
                .createApiService(CommonApi::class.java)
                .sendCaptcha(getRequestJsonBody(smsVO))
        }


    /**
     * @description 校验验证码
     * @param
     * @return
     * @author admin
     * @time 2019/8/20
     */
    fun checkCaptcha(checkSmsVO: CheckCaptchaReq): Observable<BaseResp<CheckCaptchaRes>>{
        return  RetrofitFactory.instance
            .createApiService(CommonApi::class.java)
            .checkCaptcha(getRequestJsonBody(checkSmsVO))
    }

}